﻿using System;
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using Lswweb.Domain;
using Lswweb.Model;

namespace Lswweb.Controls
{
    public class NewsSkinControl : SkinnedWebControl
    {
        protected override void CreateChildControls()
        {
            if(string.IsNullOrEmpty(SkinFileName))
                SkinFileName = NewsSkins.GetSkin(CategoryId);
            try
            {
                base.CreateChildControls();
            }
            catch
            {
                this.Visible = false;
            }
        }

        protected override void InitializeSkin(Control skin)
        {
            
        }

        private int CategoryId
        {
            get { return SiteContext.Current.CategoryId; }
        }

        protected override string DefaultSkinFilename
        {
            get { return string.Empty; }
        }
    }
}
